package com.lyl.domaindemo.Infrastructure.utils;

import org.springframework.context.ApplicationContext;

/**
 * @author lyl
 * @date 2023/6/8
 */
public class ApplicationContextUtil {

    private static ApplicationContext applicationContext;

    public static <T> T getBean(Class<T> name) {
        return applicationContext.getBean(name);
    }

    public static Object getBean(String name){
       return applicationContext.getBean(name);
    }

    public static void setContext(ApplicationContext context) {
        ApplicationContextUtil.applicationContext = context;
    }
}
